package com.schoolcloud.social.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.schoolcloud.social.entity.SocPostLikes;
import com.schoolcloud.social.mapper.SocPostLikesMapper;
import com.schoolcloud.social.service.SocPostLikesService;
import org.springframework.stereotype.Service;

/**
* @author hongmizfb
* @description 针对表【soc_post_likes】的数据库操作Service实现
* @createDate 2025-02-10 17:03:09
*/
@Service
public class SocPostLikesServiceImpl extends ServiceImpl<SocPostLikesMapper, SocPostLikes>
    implements SocPostLikesService {

    @Override
    public Long countByPostId(Integer postId) {
        return lambdaQuery().eq(SocPostLikes::getPostId, postId).count();
    }

    @Override
    public boolean isLike(Integer postId,String user) {
        return lambdaQuery().eq(SocPostLikes::getUserId, user).eq(SocPostLikes::getPostId,postId).exists();
    }
}




